package class202205.demo15.demo14;

import java.util.Arrays;

public class demo20220514 {
    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9};

        String ret = Arrays.toString(array);
        System.out.println(ret);
        //System.out.println(Arrays.toString(array)); //把参数的数组转化为 字符串作为输出

       /* for (int x: array) {
            System.out.print(x +" ");
        }
        System.out.println();*/


       /* for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }*/

    }

    /*public static void main1(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9};
        System.out.println(array[10]);//执行会抛出异常
        int[] array2 = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        String[] array4 = {"ar wei", " zhenzhen"};

        int[] array3 = new int[10];//没有初始化，默认值为0
        array3[0] = 10;

        System.out.println(array.length);//获取数组名.length来自动获取 数组长度

        System.out.print(array[0]+" ");
        System.out.print(array[1]+" ");
        System.out.print(array[2]+" ");
        System.out.print(array[3]+" ");
        System.out.print(array[4]+" ");
        System.out.print(array[5]+" ");
    }*/
}
